Skip to content

Fix Incoming Documents default processed filter - #9401

Open
Jesper Schulz-Wedde (JesperSchulz) wants to merge 4 commits into
mainfrom
jesperschulz-fix-incoming-documents-filter
Open

Fix Incoming Documents default processed filter#9401
Jesper Schulz-Wedde (JesperSchulz) wants to merge 4 commits into
mainfrom
jesperschulz-fix-incoming-documents-filter

Conversation

@JesperSchulz

@JesperSchulz Jesper Schulz-Wedde (JesperSchulz) commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

What & why

Incoming Documents no longer defaulted to unprocessed records when opened without a filter, and an explicit Processed = true filter could be cleared. Restore the default Processed = false view while preserving explicitly supplied true and false filters.

Regression tests cover all three filter scenarios.

Linked work

Fixes AB#637747

How I validated this

  • I read the full diff and it contains only changes I intended.
  • I built the affected app(s) locally with no new analyzer warnings.
  • I ran the change in Business Central and confirmed it behaves as expected.
  • I added or updated tests for the new behavior, or explained below why none are needed.

What I tested and the outcome (required - be specific: scenarios, commands, screenshots for UI changes)

  • Added regression coverage verifying that an unfiltered page defaults to unprocessed documents.
  • Added regression coverage verifying that explicit Processed = true and Processed = false filters are preserved.
  • Local execution was not completed because this workspace has no Business Central container or required AL package cache.

Risk & compatibility

Low risk. The change only affects initial page filter handling and retains existing Show All/Show Unprocessed action behavior. No data, permissions, or upgrade impact.

Restore the default unprocessed view while preserving explicit processed filters and add regression coverage for each filter scenario.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: a22e32be-3141-40ed-9a78-2302b3ba294f
@github-actions github-actions Bot added this to the Version 29.0 milestone Jul 14, 2026
@JesperSchulz Jesper Schulz-Wedde (JesperSchulz) added the Integration GitHub request for Integration area label Jul 14, 2026
@github-actions

github-actions Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Copilot PR Review

Iteration 4 · Outcome: completed

All 16 sub-skills ran to completion (either 'completed' or 'not-applicable'); none produced findings against the small, well-tested filter-preservation fix in IncomingDocuments.Page.al and its accompanying test additions.

Knowledge source: https://github.com/microsoft/BCQuality@186d8a131465475c79244d994acb872cd5c0d4bf

Orchestrator pre-filter (2 file(s) excluded)

  • layer-disabled (knowledge) : 2 file(s)

Findings produced by the Copilot CLI agent against BCQuality at 186d8a131465475c79244d994acb872cd5c0d4bf. Reply 👎 on any inline comment to flag false positives.

Comment thread src/Layers/W1/BaseApp/eServices/EDocument/IncomingDocuments.Page.al Outdated
Address review feedback by using the existing helper for the default unprocessed view.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: a22e32be-3141-40ed-9a78-2302b3ba294f
Comment thread src/Layers/W1/BaseApp/eServices/EDocument/IncomingDocuments.Page.al Outdated
Only apply the default unprocessed filter when no Processed filter is supplied, preserving the intent of bug 609129. Cover the action state for filtered entry points.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: a22e32be-3141-40ed-9a78-2302b3ba294f
Comment thread src/Layers/W1/Tests/ERM/ERMIncomingDocuments.Codeunit.al
Clear and verify variable storage around the modal page handler so each filter scenario proves the expected interaction.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: a22e32be-3141-40ed-9a78-2302b3ba294f
@JesperSchulz

Copy link
Copy Markdown
Contributor Author

Re-running CI. Something is off with the one last task which keeps failing.

Rec.FilterGroup(0);
if Rec.GetFilter(Processed) <> '' then
SetProcessedDocumentsVisibility(Rec.GetFilter(Processed) = Format(true));
if Rec.GetFilter(Processed) = '' then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$\textbf{🟡\ Medium\ Severity\ —\ Breaking\ Changes}$

This changes the externally observable OnOpenPage behavior of shipped page 190 "Incoming Documents" for callers that pass an Incoming Document record with a non-empty Processed filter into Page.Run/Page.RunModal: SetProcessedDocumentsVisibility is now never invoked for that case, so the caller's data filter is preserved, but the ShowAll/ShowUnprocessed action Enabled state (driven by ShowAllDocsIsEnable) no longer reflects the actual applied filter — it stays at its unprocessed default (ShowAll enabled, ShowUnprocessed disabled) regardless of whether the incoming filter was Processed=true or Processed=false. External extensions that open this page with a custom filter and rely on the previous enabled-state derivation will see inconsistent action availability relative to the data actually shown. Note the new tests (TestIncomingDocsPreserveProcessedFilter/TestIncomingDocsPreserveUnprocessedFilter) explicitly assert this new fixed enabled-state, indicating it may be an accepted trade-off rather than an oversight, but it should be called out explicitly since it is a change in externally visible UI state contract, not just an internal filter fix.

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.32.4

[Test]
[HandlerFunctions('IncomingDocumentsProcessedFilterHandler')]
[Scope('OnPrem')]
procedure TestIncomingDocsPreserveUnprocessedFilter()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$\textbf{🟡\ Medium\ Severity\ —\ Testing}$

TestIncomingDocsPreserveUnprocessedFilter does not actually prove that an explicit Processed=false filter is preserved rather than dropped: with the current implementation, both an explicit Processed=false external filter and no filter at all (the default-to-unprocessed path) produce an identical observable result in the handler (Processed=false, one row, ShowAll enabled, ShowUnprocessed disabled). The test therefore cannot distinguish 'filter preserved' from 'filter ignored and default applied,' so it does not add coverage beyond TestIncomingDocsDefaultToUnprocessed for that specific claim. Consider asserting something that only holds if the original filter object survived (for example, verifying no additional filter-group manipulation occurred, or restructuring so the preserved-filter case uses a value that would differ from the default outcome if broken).

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.32.4


[ModalPageHandler]
[Scope('OnPrem')]
procedure IncomingDocumentsProcessedFilterHandler(var IncomingDocuments: TestPage "Incoming Documents")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$\textbf{🟡\ Medium\ Severity\ —\ Testing}$

IncomingDocumentsProcessedFilterHandler hardcodes its expectations (row count, ShowAll.Enabled(), ShowUnprocessed.Enabled()) instead of having the calling test enqueue those expected values for the handler to dequeue and verify. Per BCQuality testing guidance, the test should own and enqueue the expected interaction state (including the enabled/disabled action states and expected row count) in call order, and the handler should only Dequeue and assert against that queued value — this makes handler/test mismatches explicit rather than baked into the handler, and keeps the three call sites (TestIncomingDocsDefaultToUnprocessed, TestIncomingDocsPreserveProcessedFilter, TestIncomingDocsPreserveUnprocessedFilter) from silently sharing hardcoded assumptions that don't vary per scenario.

Knowledge:

👍 useful · ❤️ especially valuable · 👎 wrong - reply with why · AL review agent v1.32.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Integration GitHub request for Integration area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants